﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace TulingMember.Database.Migrations.Migrations
{
    public partial class updatetablecustomer : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "DepartmentCustomer");

            migrationBuilder.AddColumn<long>(
                name: "DepartmentId",
                table: "cts_Customer",
                type: "bigint",
                nullable: false,
                defaultValue: 0L);

            migrationBuilder.UpdateData(
                table: "Role",
                keyColumn: "Id",
                keyValue: 142307070910554L,
                column: "CreatedTime",
                value: new DateTimeOffset(new DateTime(2023, 6, 12, 19, 57, 24, 840, DateTimeKind.Unspecified).AddTicks(849), new TimeSpan(0, 8, 0, 0, 0)));

            migrationBuilder.UpdateData(
                table: "Security",
                keyColumn: "Id",
                keyValue: 142307070910555L,
                column: "CreatedTime",
                value: new DateTimeOffset(new DateTime(2023, 6, 12, 19, 57, 24, 840, DateTimeKind.Unspecified).AddTicks(2234), new TimeSpan(0, 8, 0, 0, 0)));

            migrationBuilder.UpdateData(
                table: "Security",
                keyColumn: "Id",
                keyValue: 142307070910556L,
                column: "CreatedTime",
                value: new DateTimeOffset(new DateTime(2023, 6, 12, 19, 57, 24, 840, DateTimeKind.Unspecified).AddTicks(2247), new TimeSpan(0, 8, 0, 0, 0)));

            migrationBuilder.UpdateData(
                table: "Security",
                keyColumn: "Id",
                keyValue: 142307070910557L,
                column: "CreatedTime",
                value: new DateTimeOffset(new DateTime(2023, 6, 12, 19, 57, 24, 840, DateTimeKind.Unspecified).AddTicks(2249), new TimeSpan(0, 8, 0, 0, 0)));

            migrationBuilder.UpdateData(
                table: "User",
                keyColumn: "Id",
                keyValue: 142307070910551L,
                column: "CreatedTime",
                value: new DateTimeOffset(new DateTime(2023, 6, 12, 19, 57, 24, 840, DateTimeKind.Unspecified).AddTicks(9701), new TimeSpan(0, 8, 0, 0, 0)));
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "DepartmentId",
                table: "cts_Customer");

            migrationBuilder.CreateTable(
                name: "DepartmentCustomer",
                columns: table => new
                {
                    DepartmentId = table.Column<long>(type: "bigint", nullable: false),
                    CustomerId = table.Column<long>(type: "bigint", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DepartmentCustomer", x => new { x.DepartmentId, x.CustomerId });
                    table.ForeignKey(
                        name: "FK_DepartmentCustomer_cts_Customer_CustomerId",
                        column: x => x.CustomerId,
                        principalTable: "cts_Customer",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_DepartmentCustomer_cts_Department_DepartmentId",
                        column: x => x.DepartmentId,
                        principalTable: "cts_Department",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.UpdateData(
                table: "Role",
                keyColumn: "Id",
                keyValue: 142307070910554L,
                column: "CreatedTime",
                value: new DateTimeOffset(new DateTime(2023, 6, 12, 14, 21, 58, 292, DateTimeKind.Unspecified).AddTicks(3166), new TimeSpan(0, 8, 0, 0, 0)));

            migrationBuilder.UpdateData(
                table: "Security",
                keyColumn: "Id",
                keyValue: 142307070910555L,
                column: "CreatedTime",
                value: new DateTimeOffset(new DateTime(2023, 6, 12, 14, 21, 58, 292, DateTimeKind.Unspecified).AddTicks(4253), new TimeSpan(0, 8, 0, 0, 0)));

            migrationBuilder.UpdateData(
                table: "Security",
                keyColumn: "Id",
                keyValue: 142307070910556L,
                column: "CreatedTime",
                value: new DateTimeOffset(new DateTime(2023, 6, 12, 14, 21, 58, 292, DateTimeKind.Unspecified).AddTicks(4262), new TimeSpan(0, 8, 0, 0, 0)));

            migrationBuilder.UpdateData(
                table: "Security",
                keyColumn: "Id",
                keyValue: 142307070910557L,
                column: "CreatedTime",
                value: new DateTimeOffset(new DateTime(2023, 6, 12, 14, 21, 58, 292, DateTimeKind.Unspecified).AddTicks(4264), new TimeSpan(0, 8, 0, 0, 0)));

            migrationBuilder.UpdateData(
                table: "User",
                keyColumn: "Id",
                keyValue: 142307070910551L,
                column: "CreatedTime",
                value: new DateTimeOffset(new DateTime(2023, 6, 12, 14, 21, 58, 293, DateTimeKind.Unspecified).AddTicks(4843), new TimeSpan(0, 8, 0, 0, 0)));

            migrationBuilder.CreateIndex(
                name: "IX_DepartmentCustomer_CustomerId",
                table: "DepartmentCustomer",
                column: "CustomerId");
        }
    }
}
